﻿using System.ComponentModel;

namespace GarminConnect
{
    /// <summary>
    /// 活动类型枚举
    /// </summary>
    public enum ActivityType
    {
        [Description("cycling")]
        Cycling,

        [Description("fitness_equipment")]
        FitnessEquipment,

        [Description("walking")]
        Walking,

        [Description("hiking")]
        Hiking,

        [Description("other")]
        Other,

        [Description("water_sports")]
        WaterSport,

        [Description("street_running")]
        Running
    }

    /// <summary>
    /// 活动子类型枚举
    /// </summary>
    public enum ActivitySubType
    {
        [Description("indoor_cardio")]
        IndoorCardio,       // Maps to FitnessEquipment

        [Description("strength_training")]
        StrengthTraining,   // Maps to FitnessEquipment

        [Description("hiit")]
        HIIT,               // Maps to FitnessEquipment

        [Description("yoga")]
        Yoga,               // Maps to FitnessEquipment

        [Description("indoor_cycling")]
        IndoorCycling,      // Maps to Cycling

        [Description("breathwork")]
        Breathwork,         // Maps to Other

        [Description("surfing")]
        Surfing,            // Maps to WaterSport

        [Description("street_running")]
        StreetRunning,      // Maps to Running

        [Description("trail_running")]
        TrailRunning,       // Maps to Running

        [Description("indoor_running")]
        IndoorRunning       // Maps to Running
    }

    /// <summary>
    /// 活动类型信息
    /// </summary>
    public class ActivityTypeInfo
    {
        public int TypeId { get; set; }
        public string? TypeKey { get; set; }
        public int ParentTypeId { get; set; }
        public bool IsHidden { get; set; }
        public int SortOrder { get; set; } 
        public bool Trimmable { get; set; }
        public bool Restricted { get; set; }
    }

    /// <summary>
    /// 事件类型信息
    /// </summary>
    public class EventTypeInfo
    {
        public int TypeId { get; set; }
        public string? TypeKey { get; set; }
        public int SortOrder { get; set; }
    }

    /// <summary>
    /// 活动接口
    /// </summary>
    public class Activity
    {
        public int ActivityId { get; set; }
        public string? ActivityName { get; set; }
        public string? Description { get; set; }
        public string? StartTimeLocal { get; set; }
        public string? StartTimeGMT { get; set; }
        public ActivityTypeInfo ActivityType { get; set; }
        public EventTypeInfo EventType { get; set; }
        public string? Comments { get; set; }
        public string? ParentId { get; set; }
        public double Distance { get; set; }
        public double Duration { get; set; }
        public double ElapsedDuration { get; set; }
        public double MovingDuration { get; set; }
        public double ElevationGain { get; set; }
        public double ElevationLoss { get; set; }
        public double AverageSpeed { get; set; }
        public double MaxSpeed { get; set; }
        public double StartLatitude { get; set; }
        public double StartLongitude { get; set; }
        public bool HasPolyline { get; set; }
        public int OwnerId { get; set; }
        public string? OwnerDisplayName { get; set; }
        public string? OwnerFullName { get; set; }
        public string? OwnerProfileImageUrlSmall { get; set; }
        public string? OwnerProfileImageUrlMedium { get; set; }
        public string? OwnerProfileImageUrlLarge { get; set; }
        public double Calories { get; set; }
        public double AverageHR { get; set; }
        public double MaxHR { get; set; }
        public double AverageRunningCadenceInStepsPerMinute { get; set; }
        public double MaxRunningCadenceInStepsPerMinute { get; set; }
        public double AverageBikingCadenceInRevPerMinute { get; set; }
        public double MaxBikingCadenceInRevPerMinute { get; set; }
        public double AverageSwimCadenceInStrokesPerMinute { get; set; }
        public double MaxSwimCadenceInStrokesPerMinute { get; set; }
        public double AverageSwolf { get; set; }
        public double ActiveLengths { get; set; }
        public int Steps { get; set; }
        public double ConversationUuid { get; set; }
        public double ConversationPk { get; set; }
        public double NumberOfActivityLikes { get; set; }
        public double NumberOfActivityComments { get; set; }
        public double LikedByUser { get; set; }
        public double CommentedByUser { get; set; }
        public double ActivityLikeDisplayNames { get; set; }
        public double ActivityLikeFullNames { get; set; }
        public double ActivityLikeProfileImageUrls { get; set; }
        public double RequestorRelationship { get; set; }
        public List<string> UserRoles { get; set; }
        public PrivacyInfo Privacy { get; set; }
        public bool UserPro { get; set; }
        public double CourseId { get; set; }
        public double PoolLength { get; set; }
        public double UnitOfPoolLength { get; set; }
        public bool HasVideo { get; set; }
        public double VideoUrl { get; set; }
        public int TimeZoneId { get; set; }
        public long BeginTimestamp { get; set; }
        public int SportTypeId { get; set; }
        public double AvgPower { get; set; }
        public double MaxPower { get; set; }
        public double AerobicTrainingEffect { get; set; }
        public double AnaerobicTrainingEffect { get; set; }
        public double Strokes { get; set; }
        public double NormPower { get; set; }
        public double LeftBalance { get; set; }
        public double RightBalance { get; set; }
        public double AvgLeftBalance { get; set; }
        public double Max20MinPower { get; set; }
        public double AvgVerticalOscillation { get; set; }
        public double AvgGroundContactTime { get; set; }
        public double AvgStrideLength { get; set; }
        public double AvgFractionalCadence { get; set; }
        public double MaxFractionalCadence { get; set; }
        public double TrainingStressScore { get; set; }
        public double IntensityFactor { get; set; }
        public double VO2MaxValue { get; set; }
        public double AvgVerticalRatio { get; set; }
        public double AvgGroundContactBalance { get; set; }
        public double LactateThresholdBpm { get; set; }
        public double LactateThresholdSpeed { get; set; }
        public double MaxFtp { get; set; }
        public double AvgStrokeDistance { get; set; }
        public double AvgStrokeCadence { get; set; }
        public double MaxStrokeCadence { get; set; }
        public double WorkoutId { get; set; }
        public double AvgStrokes { get; set; }
        public double MinStrokes { get; set; }
        public int DeviceId { get; set; }
        public double MinTemperature { get; set; }
        public double MaxTemperature { get; set; }
        public double MinElevation { get; set; }
        public double MaxElevation { get; set; }
        public double AvgDoubleCadence { get; set; }
        public double MaxDoubleCadence { get; set; }
        public double SummarizedExerciseSets { get; set; }
        public double MaxDepth { get; set; }
        public double AvgDepth { get; set; }
        public double SurfaceInterval { get; set; }
        public double StartN2 { get; set; }
        public double EndN2 { get; set; }
        public double StartCns { get; set; }
        public double EndCns { get; set; }
        public SummarizedDiveInfo SummarizedDiveInfo { get; set; }
        public double ActivityLikeAuthors { get; set; }
        public double AvgVerticalSpeed { get; set; }
        public double MaxVerticalSpeed { get; set; }
        public double FloorsClimbed { get; set; }
        public double FloorsDescended { get; set; }
        public string? Manufacturer { get; set; }
        public double DiveNumber { get; set; }
        public string? LocationName { get; set; }
        public double BottomTime { get; set; }
        public int LapCount { get; set; }
        public double EndLatitude { get; set; }
        public double EndLongitude { get; set; }
        public double MinAirSpeed { get; set; }
        public double MaxAirSpeed { get; set; }
        public double AvgAirSpeed { get; set; }
        public double AvgWindYawAngle { get; set; }
        public double MinCda { get; set; }
        public double MaxCda { get; set; }
        public double AvgCda { get; set; }
        public double AvgWattsPerCda { get; set; }
        public double Flow { get; set; }
        public double Grit { get; set; }
        public double JumpCount { get; set; }
        public double CaloriesEstimated { get; set; }
        public double CaloriesConsumed { get; set; }
        public double WaterEstimated { get; set; }
        public double WaterConsumed { get; set; }
        public double MaxAvgPower_1 { get; set; }
        public double MaxAvgPower_2 { get; set; }
        public double MaxAvgPower_5 { get; set; }
        public double MaxAvgPower_10 { get; set; }
        public double MaxAvgPower_20 { get; set; }
        public double MaxAvgPower_30 { get; set; }
        public double MaxAvgPower_60 { get; set; }
        public double MaxAvgPower_120 { get; set; }
        public double MaxAvgPower_300 { get; set; }
        public double MaxAvgPower_600 { get; set; }
        public double MaxAvgPower_1200 { get; set; }
        public double MaxAvgPower_1800 { get; set; }
        public double MaxAvgPower_3600 { get; set; }
        public double MaxAvgPower_7200 { get; set; }
        public double MaxAvgPower_18000 { get; set; }
        public double ExcludeFromPowerCurveReports { get; set; }
        public double TotalSets { get; set; }
        public double ActiveSets { get; set; }
        public double TotalReps { get; set; }
        public double MinRespirationRate { get; set; }
        public double MaxRespirationRate { get; set; }
        public double AvgRespirationRate { get; set; }
        public double TrainingEffectLabel { get; set; }
        public double ActivityTrainingLoad { get; set; }
        public double AvgFlow { get; set; }
        public double AvgGrit { get; set; }
        public double MinActivityLapDuration { get; set; }
        public double AvgStress { get; set; }
        public double StartStress { get; set; }
        public double EndStress { get; set; }
        public double DifferenceStress { get; set; }
        public double MaxStress { get; set; }
        public double AerobicTrainingEffectMessage { get; set; }
        public double AnaerobicTrainingEffectMessage { get; set; }
        public List<double> SplitSummaries { get; set; }
        public bool HasSplits { get; set; }
        public double MaxBottomTime { get; set; }
        public double HasSeedFirstbeatProfile { get; set; }
        public double CalendarEventId { get; set; }
        public double CalendarEventUuid { get; set; }
        public double AvgGradeAdjustedSpeed { get; set; }
        public double AvgWheelchairCadence { get; set; }
        public double MaxWheelchairCadence { get; set; }
        public bool Purposeful { get; set; }
        public bool ManualActivity { get; set; }
        public bool AutoCalcCalories { get; set; }
        public bool ElevationCorrected { get; set; }
        public bool AtpActivity { get; set; }
        public bool Favorite { get; set; }
        public double DecoDive { get; set; }
        public bool Pr { get; set; }
        public bool Parent { get; set; }
    }

    /// <summary>
    /// 隐私信息
    /// </summary>
    public class PrivacyInfo
    {
        public int TypeId { get; set; }
        public string? TypeKey { get; set; }
    }

    /// <summary>
    /// 潜水数据概括
    /// </summary>
    public class SummarizedDiveInfo
    {
        public double Weight { get; set; }
        public double WeightUnit { get; set; }
        public double Visibility { get; set; }
        public double VisibilityUnit { get; set; }
        public double SurfaceCondition { get; set; }
        public double Current { get; set; }
        public double WaterType { get; set; }
        public double WaterDensity { get; set; }
        public List<double> SummarizedDiveGases { get; set; } = new List<double>();
        public double TotalSurfaceTime { get; set; }
    }

    /// <summary>
    /// 活动UUID
    /// </summary>
    public class ActivityUUID
    {
        public string? Uuid { get; set; }
    }

    /// <summary>
    /// 活动类型数据传输对象
    /// </summary>
    public class ActivityTypeDTO
    {
        public int TypeId { get; set; }
        public string? TypeKey { get; set; }
        public int ParentTypeId { get; set; }
        public bool IsHidden { get; set; }
        public bool Restricted { get; set; }
        public bool Trimmable { get; set; }
    }

    /// <summary>
    /// 事件类型数据传输对象
    /// </summary>
    public class EventTypeDTO
    {
        public int TypeId { get; set; }
        public string? TypeKey { get; set; }
        public int SortOrder { get; set; }
    }

    /// <summary>
    /// 访问控制规则数据传输对象
    /// </summary>
    public class AccessControlRuleDTO
    {
        public int TypeId { get; set; }
        public string? TypeKey { get; set; }
    }

    /// <summary>
    /// 时区单位数据传输对象
    /// </summary>
    public class TimeZoneUnitDTO
    {
        public int UnitId { get; set; }
        public string? UnitKey { get; set; }
        public double Factor { get; set; }
        public string? TimeZone { get; set; }
    }

    /// <summary>
    /// 文件格式
    /// </summary>
    public class FileFormat
    {
        public int FormatId { get; set; }
        public string? FormatKey { get; set; }
    }

    /// <summary>
    /// 用户信息数据传输对象
    /// </summary>
    public class UserInfoDTO
    {
        public int UserProfilePk { get; set; }
        public string? Displayname { get; set; }
        public string? Fullname { get; set; }
        public string? ProfileImageUrlLarge { get; set; }
        public string? ProfileImageUrlMedium { get; set; }
        public string? ProfileImageUrlSmall { get; set; }
        public bool UserPro { get; set; }
    }

    /// <summary>
    /// 设备元数据数据传输对象
    /// </summary>
    public class DeviceMetaDataDTO
    {
        public string? DeviceId { get; set; }
        public int DeviceTypePk { get; set; }
        public int DeviceVersionPk { get; set; }
    }

    /// <summary>
    /// 活动元数据数据传输对象
    /// </summary>
    public class MetadataDTO
    {
        public bool IsOriginal { get; set; }
        public int DeviceApplicationInstallationId { get; set; }
        public double AgentApplicationInstallationId { get; set; }
        public double AgentString { get; set; }
        public FileFormat? FileFormat { get; set; }
        public double AssociatedCourseId { get; set; }
        public string? LastUpdateDate { get; set; }
        public string? UploadedDate { get; set; }
        public double VideoUrl { get; set; }
        public bool HasPolyline { get; set; }
        public bool HasChartData { get; set; }
        public bool HasHrTimeInZones { get; set; }
        public bool HasPowerTimeInZones { get; set; }
        public UserInfoDTO? UserInfoDto { get; set; }
        public List<double>? ChildIds { get; set; }
        public List<double>? ChildActivityTypes { get; set; }
        public List<double>? Sensors { get; set; }
        public List<double>? ActivityImages { get; set; }
        public string? Manufacturer { get; set; }
        public double DiveNumber { get; set; }
        public int LapCount { get; set; }
        public int AssociatedWorkoutId { get; set; }
        public double IsAtpActivity { get; set; }
        public DeviceMetaDataDTO? DeviceMetaDataDTO { get; set; }
        public bool HasIntensityIntervals { get; set; }
        public bool HasSplits { get; set; }
        public double EBikeMaxAssistModes { get; set; }
        public double EBikeBatteryUsage { get; set; }
        public double EBikeBatteryRemaining { get; set; }
        public double EBikeAssistModeInfoDTOList { get; set; }
        public double CalendarEventInfo { get; set; }
        public bool PersonalRecord { get; set; }
        public bool Gcj02 { get; set; }
        public double RunPowerWindDataEnabled { get; set; }
        public bool AutoCalcCalories { get; set; }
        public bool Favorite { get; set; }
        public bool ManualActivity { get; set; }
        public bool Trimmed { get; set; }
        public bool ElevationCorrected { get; set; }
    }

    /// <summary>
    /// 概况数据传输对象
    /// </summary>
    public class SummaryDTO
    {
        public string? StartTimeLocal { get; set; }
        public string? StartTimeGMT { get; set; }
        public double StartLatitude { get; set; }
        public double StartLongitude { get; set; }
        public double Distance { get; set; }
        public double Duration { get; set; }
        public double MovingDuration { get; set; }
        public double ElapsedDuration { get; set; }
        public double ElevationGain { get; set; }
        public double ElevationLoss { get; set; }
        public double MaxElevation { get; set; }
        public double MinElevation { get; set; }
        public double AverageSpeed { get; set; }
        public double AverageMovingSpeed { get; set; }
        public double MaxSpeed { get; set; }
        public double Calories { get; set; }
        public double AverageHR { get; set; }
        public double MaxHR { get; set; }
        public double AverageRunCadence { get; set; }
        public double MaxRunCadence { get; set; }
        public double AverageTemperature { get; set; }
        public double MaxTemperature { get; set; }
        public double MinTemperature { get; set; }
        public double GroundContactTime { get; set; }
        public double GroundContactBalanceLeft { get; set; }
        public double StrideLength { get; set; }
        public double VerticalOscillation { get; set; }
        public double TrainingEffect { get; set; }
        public double AnaerobicTrainingEffect { get; set; }
        public string? AerobicTrainingEffectMessage { get; set; }
        public string? AnaerobicTrainingEffectMessage { get; set; }
        public double VerticalRatio { get; set; }
        public double EndLatitude { get; set; }
        public double EndLongitude { get; set; }
        public double MaxVerticalSpeed { get; set; }
        public double MinActivityLapDuration { get; set; }
    }

    /// <summary>
    /// 分段概况信息
    /// </summary>
    public class SplitSummary
    {
        public double Distance { get; set; }
        public double Duration { get; set; }
        public double MovingDuration { get; set; }
        public double ElapsedDuration { get; set; }
        public double ElevationGain { get; set; }
        public double ElevationLoss { get; set; }
        public double AverageSpeed { get; set; }
        public double AverageMovingSpeed { get; set; }
        public double MaxSpeed { get; set; }
        public double Calories { get; set; }
        public double AverageHR { get; set; }
        public double MaxHR { get; set; }
        public double AverageRunCadence { get; set; }
        public double MaxRunCadence { get; set; }
        public double AverageTemperature { get; set; }
        public double MaxTemperature { get; set; }
        public double MinTemperature { get; set; }
        public double GroundContactTime { get; set; }
        public double GroundContactBalanceLeft { get; set; }
        public double StrideLength { get; set; }
        public double VerticalOscillation { get; set; }
        public double VerticalRatio { get; set; }
        public int TotalExerciseReps { get; set; }
        public string? SplitType { get; set; }
        public int NoOfSplits { get; set; }
        public double MaxElevationGain { get; set; }
        public double AverageElevationGain { get; set; }
        public double MaxDistance { get; set; }
    }

    /// <summary>
    /// 活动详情接口
    /// </summary>
    public interface IActivityDetails
    {
        public int ActivityId { get; set; }
        public ActivityUUID ActivityUUID { get; set; }
        public string? ActivityName { get; set; }
        public int UserProfileId { get; set; }
        public bool IsMultiSportParent { get; set; }
        public ActivityTypeDTO ActivityTypeDTO { get; set; }
        public EventTypeDTO EventTypeDTO { get; set; }
        public AccessControlRuleDTO AccessControlRuleDTO { get; set; }
        public TimeZoneUnitDTO TimeZoneUnitDTO { get; set; }
        public MetadataDTO MetadataDTO { get; set; }
        public SummaryDTO SummaryDTO { get; set; }
        public string? LocationName { get; set; }
        public List<SplitSummary> SplitSummaries { get; set; }
    }

}
